						
						
						
						**************
						** Figure 3 **
						**************
						
	
			clear
			version 16.1
			set max_memory 32g, permanently
			set seed 1234
			set level 95 		
			
			cd "~"
	
						***********************
						** MERGING DATASETS ***
						***********************
 
	** VTFE results **
	
	import excel "EBA VTFE results.xlsx", sheet("VTFE") firstrow case(lower) clear


		drop if var==""
	
		drop  notes
		gen round="VTFE"
		
		save "vtfe.dta", replace
	
	
	** VTRE results **
		
		import excel "EBA VTRE results.xlsx", sheet("VTRE") firstrow case(lower) clear

		drop notes aa ab type

		drop if var==""
		gen round="VTRE"
		
		
		save "vtre.dta", replace
	
		order round	
	

	
	** VTNLFE results **
	
		import excel "EBA VTNLFE results.xlsx", sheet("VTNL") firstrow case(lower) clear

		drop if var==""
	
		drop af ag ah ai notes
		gen round="VTNLFE"
		
		save "vtnlfe.dta", replace
	
	
	** VTNLRE results **
		
		import excel "EBA VTNLRE results.xlsx", sheet("VTNLRE") firstrow case(lower) clear

		drop notes aa ab type

		drop if var==""
		gen round="VTNLRE"
		
		
		save "vtnlre.dta", replace
	
		append using "vtnlfe.dta"
		append using "vtfe.dta"		
		append using "vtre.dta"	
		
		order round
	
	** Merging 2018 models
	
		append using "eba_4results.dta"
	
	drop hs_* dofile order makenum round_num  type vifl
	
	sort var
	
	replace variable="Cumulative executive responsiveness" if variable=="Executive responsiveness"
	replace variable="Previous turnout" if variable=="Previous turnout (# Voters)"
	replace variable="Previous turnout" if variable=="Previous turnout (%VAP)"
	replace variable="Previous turnout" if variable=="VT Lag"
	
	
	
	encode variable, gen(varnum) label(varnum)
             
            sort mean
            format mean %9.2g
            l varnum lower_eb upper_eb  mean  
             lab var varnum "Variable"
	
	** Significant variables **
	
	** LEAMER
	gen leamer=.
	replace leamer=0 if lower_eb<=0 & upper_eb>0
	replace leamer=1 if lower_eb<=0 & upper_eb<=0
	replace leamer=1 if lower_eb>0 & upper_eb>0
	browse  lower_eb upper_eb robust leamer
	replace leamer=. if lower_eb==0 & upper_eb==0
	drop robust
	
	** SIM **
	replace cdf_pct_above_0=. if cdf_pct_less_0==.
	gen sim=.

	replace sim=0 if cdf_pct_less_0>0.05 & cdf_pct_above_0 <0.95 & cdf_pct_less_0~=.
	replace sim=1 if cdf_pct_less_0<0.05 
	replace sim=1 if cdf_pct_less_0>0.95 
 	browse variable cdf_pct_less_0 cdf_pct_above_0 simrobust sim	
	 	
	drop simrobust
	replace variable="1945-1994" if variable=="1919-1994"
	replace variable="1945-1994" if variable=="1919-1944"	
	replace varnum=4 if varnum==3
	replace varnum=52 if varnum==46

	 * Lagged dv Lagged DV Previous turnout 34 35 change to 51
	 
	 replace varnum=51 if varnum==34
	 replace varnum=51 if varnum==35	 
	 
	 ** PR Proportional representation
 	 replace varnum=51 if varnum==34
	 replace varnum=51 if varnum==35	 
	
	save "eba 2021 merged results.dta", replace


						************************
						** COEFFICIENT GRAPHS **
						************************
						

	
	browse varnum if sim==1 & round=="VTFE"
	
			local varlist "4 15 16 17 21 29 32 33 38 49 51 52 55 58 59 63 66 "
			
			foreach x of local varlist {
			use "eba 2021 merged results.dta", clear	
				
			keep variable  varnum round lower_eb upper_eb mean 
			keep if varnum==`x'
			 
			gen order=.
	
			replace order=8 if round=="VTFE"
			replace order=7 if round=="VTRE"
			replace order=6 if round=="VTNLFE"
			replace order=5 if round=="VTNLRE"
			replace order=4 if round=="VT"			
			replace order=3 if round=="VTNL"				
			replace order=2 if round=="VAPVT"
			replace order=1 if round=="VTA"
	 
	 
	 	    twoway (rspike lower_eb upper order, horizontal		///
			msize(small) lwidth(vthin)) , 						///
			xline(0, lcolor(cranberry) lwidth(vthin))			///  
			xlabel(,  labsize(small)) 							///
			xtitle("") 											///
			ylabel(1 "VTA" 2 "VAP" 3 "VTNL" 4 "VT" 5 "VTNLRE" 6 "VTNLFE" 7 "VTRE"  8 "VTFE"    )  	///
			ytitle("") 											///									
			title(`x') ||			 			/// 		 
			(scatter order mean if order==1 ,   msize(medium) mlwidth(vthin) mlcolor(black) msymbol(S) mcolor(cranberry) legend(off)) ///
			(scatter order mean if order==2 ,   msize(medium) mlwidth(vthin) mlcolor(black) msymbol(S) mcolor(cranberry) legend(off)) ///
			(scatter order mean if order==3 ,   msize(medium) mlwidth(vthin) mlcolor(black) msymbol(S) mcolor(cranberry) legend(off)) ///
			(scatter order mean if order==4 ,   msize(medium) mlwidth(vthin) mlcolor(black) msymbol(S) mcolor(cranberry) legend(off))  ///
			(scatter order mean if order==5 ,   msize(medium) mlwidth(vthin) mlcolor(black) msymbol(S) mcolor(cranberry) legend(off))  ///			
			(scatter order mean if order==6 ,   msize(medium) mlwidth(vthin) mlcolor(black) msymbol(S) mcolor(cranberry) legend(off)) ///		
			(scatter order mean if order==7 ,   msize(medium) mlwidth(vthin) mlcolor(black) msymbol(S) mcolor(cranberry) legend(off)) ///					
			(scatter order mean if order==8 ,   msize(medium) mlwidth(vthin) mlcolor(black) msymbol(S) mcolor(cranberry) legend(off)) 					
			
			
			graph save `x'.gph, replace
		
		 	
			}
			
			************************************
			** CLEANING AND MERGING VARIABLES **
			************************************
			
				use "eba 2021 merged results.dta"	, clear			 
			
			**  15 Closeness/competitiveness **
			
				browse round lower upper cdf* if varnum==15
				
				graph use "15.gph"
				
				sort cdf_pct_le
				browse round lower upper cdf* if varnum==15
				
				** SIM SIGN: VTFE VTNLFE VTNLRE 
				** CHANGE in graph editor to add (s) and title
				
				*graph save "graph2" "15e.gph"
				
			
			** 52 PR **
			
				browse round lower upper cdf* if varnum==52
				sort cdf_pct_le
				graph use "52.gph"
				
				sort cdf_pct_le
				browse round lower upper cdf* if varnum==15
				
				** SIM SIGN:   VTNLFE VTFE 
				** CHANGE in graph editor to add (s) and title
				
			** 16 compulsory voting **	 
			
				browse round lower upper cdf* if varnum==16
				sort cdf_pct_le
				graph use "16.gph"
				
				sort cdf_pct_le
				browse round lower upper cdf* if varnum==16	
			
			/** 49 Population (too big to include FE confidence intervals**
			** did the graph then Stata crashed.
			
				browse round lower upper cdf* if varnum==49
				sort cdf_pct_le
				graph use "49.gph"
				
			 
				** Leam sign: vtnl vapvt vtnlre
				
				** CHANGE in graph editor to add (s) and title			 */	
			
	 			**  51 Previous turnout **	 
			
				use "eba 2021 merged results.dta"	, clear	
				browse round lower upper cdf* if varnum==51
				sort cdf_pct_le
				graph use "51.gph"
				 
				** 4 years 1945-1994 **
				tab variable if varnum==4
				browse variable round lower upper cdf* if varnum==4
				sort cdf_pct_le
				graph use "4.gph"
			 			
				** 17 Concurrent **
				tab variable if varnum==17
				browse variable round lower upper cdf* if varnum==17
				sort cdf_pct_le
				graph use "17.gph"
			 	 				
				** 21 econ globalization **
				tab variable if varnum==21
				browse variable round lower upper cdf* if varnum==21
				sort cdf_pct_le
				graph use "21.gph"
			 			
				** 29 GNI **
				tab variable if varnum==29
				browse variable round lower upper cdf* if varnum==29
				sort cdf_pct_le
				graph use "29.gph"
			 			
				** 32 Inflation **
				tab variable if varnum==32
				browse variable round lower upper cdf* if varnum==32
				sort cdf_pct_le
				graph use "32.gph"
														
				** 55 2nd election **
				tab variable if varnum==55
				browse variable round lower upper cdf* if varnum==55
				sort cdf_pct_le
				graph use "55.gph"
														
				** 58 spending decentralization **
				tab variable if varnum==58
				browse variable round lower upper cdf* if varnum==58
				sort cdf_pct_le
				graph use "58.gph"
																		
				** 59 Sufferage **
				tab variable if varnum==59
				browse variable round lower upper cdf* if varnum==59
				sort cdf_pct_le
				graph use "59.gph"
								
				** 63 Time trend **
				tab variable if varnum==63
				browse variable round lower upper cdf* if varnum==63
				sort cdf_pct_le
				graph use "63.gph"
										
				**  66 **
				tab variable if varnum==66
				browse variable round lower upper cdf* if varnum==66
				sort cdf_pct_le
				graph use "66.gph"

				graph combine 4e.gph  15e.gph 16e.gph 17e.gph 21e.gph ///
							  29e.gph 32e.gph 51e.gph 49e.gph 52e.gph ///
							  55e.gph 58e.gph 59e.gph 63e.gph 66e.gph ///
							  , cols(5) xsize(6) ysize(4)
				
				
				

		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
